let includes = ([
    "include/common.js",
    "include/global.js"
]);

let inherits = ([
    "inherit/data.js",
]);



function create() {
    return thisObject();
}

let battle;


function testCombat() {

    let me = thisObject();
    if (!battle) {
        battle = newObj("clone/roundBattle.js");
        let usr = newObj("clone/user.js");
        let usr2 = newObj("clone/user.js");
        os.debug(usr);
        usr.set("asdasd", 1);
        os.debug(usr);
        usr.set("hp", 100);
        usr.set("defense", 5);
        usr2.set("hp", 100);
        usr2.set("defense", 5);

        usr.set("rdSkills", [
            100001, 100002
        ]);


        usr2.set("rdSkills", [
            100068, 100076
        ]);


        //
        battle.addKills("kill1", [usr]);
        battle.addKills("kill2", [usr2]);
        return {};
    }

    battle.heartbeat();

}


//程序入口......
//FarOS循环调用main方法....
let x;


function enen() {
    os.debug("哈哈")
}



function workCall(a) {
    os.debug(a,"被线程调用的外部函数");
    
}



function main() {
    //
    // if( !battle ){
    //     battle = true;
    // }
    // return ;




    let me = thisObject();
    let obs = getObjects();
    for (let i in obs) {
        if (undefinedp(obs[i].get)) continue;
        if (undefinedp(obs[i].heartbeat)) continue;
        if (obs[i].get("heartbeat")) {
            obs[i].heartbeat();
        }
    }
    return true;
}


function teststment() {

    //  let userxx = newObj("clone/user.js");
    // userxx.receiveDamage("hp",1);
    // os.debug(userxx);
    //D("test/testdb.js").heartbeat();

    // os.debug(userxx,"看看导入对象咋样...");
    //
    //D(FIX_ROUND_D).heartbeat();
// os.debug("asdasd");
    // me.testCombat();
    // if(x!=1){
    //     httpTest();
    //     x=1;
    // }

    //  let data = os.db.select("select * from w_users where id=8442");

    // let data = os.db.add("insert into w_users (username)VALUE('faros测试')");
    // os.debug(data);
    // data = JSON.parse(data);
    // os.debug(data[0].id);
    //os.debug(os.time.timeMillis());
    //D("test/testtime.js").timeMills();
    //D("test/db.js").insert();
}
